home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Programming / AmigaTalk / TestFiles / TestGraphPaper < prev    next >
Text File  |  2000-05-08  |  964b  |  38 lines

  1. )i AmigaTalk:User/Graph.st
  2.  
  3. g <- Graph new  "Graph is in AmigaTalk:User/Graph.st"
  4.  
  5. g initialize: 'TestGraph' winTitle: 'TestGraphPaper'
  6.  
  7. g open: 16r40D20001 from: 0@0 to: 640@480
  8.  
  9. g setXAxisFrom: -10.0  to: 10.0  by: 0.1
  10. g setYAxisFrom: -100.0 to: 100.0 by: 1.0
  11.  
  12. crs <- Colors new: 'TestGraphPaper'
  13.  
  14. crs loadColors: 16 from: 'Amigatalk:AmigaTalk.colors'
  15. crs setWindowColorReg: 1 red: 12 green: 12 blue: 12
  16. crs setWindowColorReg: 2 red: 0  green: 0  blue: 8
  17. crs setWindowColorReg: 3 red: 8  green: 8  blue: 8
  18. crs setWindowColorReg: 4 red: 8  green: 0  blue: 8
  19. crs setWindowColorReg: 5 red: 0  green: 8  blue: 8
  20. crs setWindowColorReg: 6 red: 8  green: 8  blue: 0
  21.  
  22. g drawGrid: 20 y: 20 color: 2
  23.  
  24. g drawXAxis: 0.0 numTicks: 10 color: 4
  25. g drawYAxis: 0.0 numTicks: 10 color: 5
  26.  
  27. g setPen: 1
  28.  
  29. g drawLabel: 'y-axis' at: 325@9
  30. g drawLabel: 'x-axis' at: 580@230
  31.  
  32. x1 <- 0.0
  33. y1 <- 0.0
  34.  
  35. g setPen: 2
  36.  
  37. (-9.9 to: 10.0 by: 0.1) do: [:x| x1 <- x. y1 <- x * x. g plotPoint: x1 y: y1]
  38.